#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

int x, y;
int M, N;

struct node
{
    int x1, x2, y1, y2;
};

int x1, x2, y1, y2;

node n[2010];

int main()
{
    cin >> M >> N;
    for (int i = 1; i <= M; i++)
    {
        cin >> x1 >> y1 >> x2 >> y2;
        n[i] = {x1, x2, y1, y2};
    }
    for (int i = 1; i <= N; i++)
    {
        cin >> x >> y;
        int ans = 0;
        int last = 0;   
        for(int j=1;j<=M;j++){
            if(x>=n[j].x1 && x<=n[j].x2 && y>=n[j].y1 && y<=n[j].y2){
                ans++;
                last = j;
            }
        }
        if(ans) cout<<"YES "<<ans<<" "<<last<<endl;
        else cout<<"NO"<<endl;
    }
  system("pause");
    return 0;
}